<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org" lang="en">
<head>
    <meta charset="UTF-8"/>
    <meta http-equiv="X-UA-Compatible" content="IE=edge"/>
    <meta name="viewport" content="width=device-width, initial-scale=1.0"/>
    <title>Document</title>
    <script src="https://unpkg.com/vue@next"></script>
</head>

<body>
<div id="app">
    <p>user.html</p>
    <p> 你好：<span th:text="${name}">请跟我来</span></p>
    <p><input type="text" name="userName" value="James Carrot" th:value="${name}"/></p>

    <div>
        <button v-on:click="dologin($this)">授权登录</button>
    </div>

</div>

</body>
<!-- import Vue before Element -->
<!--<script src="https://unpkg.com/vue/dist/vue.js"></script>-->
<!-- import JavaScript -->
<!--<script src="https://unpkg.com/element-ui/lib/index.js"></script>-->
<script>
    var cookie = document.cookie;
    console.log(cookie);

    const app = {
        data() {
            return {
                counter: 1,
                event: "",
                redirect_urii: "http://www.luckycy.top/user/userpage",
                appid: "wx9bfdabf6e25a0331",
                appsecret: "e3d530ee9dbfff8e42ef884383b3f43b",
                scope: ""
            };
        },

        methods: {
            dologin() {
                this.counter++;
                encodeurl =
                    'https://open.weixin.qq.com/connect/oauth2/authorize?appid='
                    + this.appid +
                    '&redirect_uri='
                    + encodeURIComponent(this.redirect_urii) +
                    '&response_type=code&scope=snsapi_userinfo&state=1111#wechat_redirect';
                console.log(encodeurl);
                window.location.href = encodeurl;
            }
        }
    }

    const v = Vue.createApp(app);

    v.mount("#app");

</script>
</html>
